#! /usr/bin/env python

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

class Colors:
	def __init__(self, fst, lst):
		self.fst = fst
		self.lst = lst
		self.delta_r = (lst[0]-fst[0])
		self.delta_g = (lst[1]-fst[1])
		self.delta_b = (lst[2]-fst[2])

	def get(self, l):
		rate_r = self.delta_r/(l-1)
		rate_g = self.delta_g/(l-1)
		rate_b = self.delta_b/(l-1)
		
		for i in range(l):
			yield (max(i * rate_r + self.fst[0], 0),
						max(i * rate_g + self.fst[1], 0),
						max(i * rate_b + self.fst[2], 0))
